﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.Infra.UI.Common;

namespace Sinacor.UI.Bovespa.Clientes.Communication.Translator.DataContractToModel
{
    public class RelacionamentoBroker
    {
        public ModelCollection<Model.RelacionamentoBroker> ToRelacionamentoBroker(List<Bovespa.Cliente.RelacionamentoBroker.RelacionamentoBrokerResponse> from)
        {
            ModelCollection<Model.RelacionamentoBroker> to = null;

            if (from != null)
            {
                to = new ModelCollection<Model.RelacionamentoBroker>();

                foreach (Bovespa.Cliente.RelacionamentoBroker.RelacionamentoBrokerResponse item in from)
                {
                    to.Add(ToRelacionamentoBroker(item));
                }
            }

            return to;
        }

        public Model.RelacionamentoBroker ToRelacionamentoBroker(Bovespa.Cliente.RelacionamentoBroker.RelacionamentoBrokerResponse from)
        {
            Model.RelacionamentoBroker to = null;

            if (from != null)
            {
                to = new Model.RelacionamentoBroker();

                to.ApelidoBrokerIntermediario = from.ApelidoBrokerIntermediario;
                to.ApelidoBrokerPrincipal = from.ApelidoBrokerPrincipal;
                to.CodigoBrokerCliente = from.CodigoBrokerCliente;
                to.CodigoBrokerIntermediario = from.CodigoBrokerIntermediario;
                to.CodigoBrokerPrincipal = from.CodigoBrokerPrincipal;
            }

            return to;
        }
    }
}
